<%@ page language="java" %>
<%@ page session="true" %>
<%@ page import="java.sql.*,java.io.*,java.util.Random"%>
 <% String userid = request.getParameter("userid");%>

<HEAD>


	<script LANGUAGE="Javascript" SRC="Images/validate.js"></script>


	<LINK href="styles.css" type="text/css" rel="stylesheet">
<SCRIPT LANGUAGE="JavaScript">
<!--
function sendInfo(txtVal)
{
		var txt = window.opener.document.forms(0).userid;
		txt.value = txtVal;
		window.close();
}

//-->
</SCRIPT>

</HEAD>
<BODY class=Grad>
<h2 align=center><FONT SIZE="" COLOR="#990000">Check Availbility</FONT></h2>

<%

	Connection con=null;
	ResultSet rs=null;
	Statement stmt=null;
	try{
			
			/* Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
			con = DriverManager.getConnection("jdbc:odbc:JobPortal","root",""); */

			Class.forName("com.mysql.jdbc.Driver");
			con = DriverManager.getConnection("jdbc:mysql://localhost:3306/jobmiller","root","root");

			stmt =  con.createStatement();
			String Query = "Select * from login where userid='"+userid+"'";
			rs = stmt.executeQuery(Query);
			%>
						<table align="center" width="60%">
							<tr class=row_title>
							
					<%
			int rCount=0;
			while(rs.next())
			{ userid=rs.getString(1);
					%>
					
					<%
				rCount++;
			}
			if( rCount > 0)	{%><h3 align=center><FONT SIZE="2" COLOR="#330000">User Name: <B><%=userid%></B> already exists <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Please choose another </h3><br>
			<h3 align=center>Suggestions:<a href="#" onclick="sendInfo('<%=userid%>1')"><%=userid%>1</a><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
			<a href="#" onclick="sendInfo('<%=userid%>11')"><%=userid%>11</a><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;	
			<a href="#" onclick="sendInfo('<%=userid%>111')"><%=userid%>111</a><br></Font>
			<% }
			else{%><h3 align=center> <FONT SIZE="2" COLOR="#330000">User Name: <a href="#" onclick="sendInfo('<%=userid%>')"><%=userid%></a> is available</h3> <br><h3 align=center>click on user name to proceed </Font></h3><%}

			rs.close();
			stmt.close();
			con.close();
		}catch(Exception e){
			rs.close();
			stmt.close();
			con.close();
			%><%=e%><%
		}
	
%>
</BODY>


